You can use two options to ld to specify a registry file: -check_registry and -update_registry. When you invoke ld to build a shared object, with the argument -check_registry file, ld makes sure that the new shared object doesn't conflict with any of the shared objects listed in file. When invoked with -update_registry file, ld checks the registry in the same way, but when it's done, it writes an entry in file for the DSO being built. If file isn't writable, -update_registry acts like -check_registry. If file isn't readable, both -update_registry and -check_registry are ignored.
By exchanging registry files, providers of DSOs can avoid collisions between their shared objects. It's best to start with a copy of /usr/lib/so_locations, so that your shared objects don't conflict with any of the standard DSOs. However, remember that when collisions occur between shared objects, the only effect is slowing program startup.
$text_align_size=align padding=pad-size $data_align_size=align padding=pad-sizeThese two directives specify the alignment and padding requirements for text and data segments, respectively. The current default segment alignment is 64K, which is the minimum permissible. The size value of a segment of a DSO appearing in the registry file is calculated based on the actual section size plus padding, and is aligned to the section align size (either the default or the one specified by the above directive). The align values for text and data as well as the padding values must be aligned to the minimum alignment size (64K). If not, ld generates a warning message and aligns these values to the minimum alignment.
$start_address=addrThis directive specifies where to start looking for addresses to put shared objects. The default start_address is 0x6000000.
$data_after_text={ 1 | 0 }In this directive, a value of one instructs the linker to place data immediately after the text at specified text and data alignment requirements. A value of zero (the default) allows the linker to place these segments in different portions of the address space.
so_name [ :st = {.text | .data | $range} base_addr,padded_size : ] *where:
libc.so.1 \ :st = $range 0x5fc00000, 0x00400000:\ :st = .text 0x5fe40000, 0x000a0000:\ :st = .data 0x5fee0000, 0x00030000:This specification instructs ld to relocate all segments of libc.so.1 in the range 0x5fc00000 to 0x5fc00000+0x0040000, and, if possible, to place the text segment at 0x5fe40000 and the data segment at 0x5fee0000. The text segment should be padded to 0xa0000 bytes and the data segment to 0x3000 bytes. See /usr/lib/so_locations for examples of shared object specifications.
When building a DSO with the -check_registry or -update_registry flag, if an entry corresponding to this DSO exists in the registry file, the linker tries to assign the indicated addresses for text and data. However, if the size of the DSO changes and no longer fits in the specified location, the linker searches for another location that fits. If the $range option is specified, the linker places the DSO only in the specified range of addresses. If there isn't enough room, an error is returned.